package com.bjc.platform.util;

import java.util.ArrayList;
import java.util.List;

public class MyStringUtils {
	
	/**
	 * return true when null, empty string or string containing whitespace only
	 * @param s
	 * @return
	 */
	public static boolean isEmptyOrWhitespace(String s){
		return s == null ? true : (s.trim().equals("")? true : false);
	}
	
	

	/**
	 * 将字符串转换为List集合: example: "arr" 转换为一个元素的List集合 "[arr1,arr2]" 转为多个元素的List集合
	 * 
	 * @param o
	 * @return
	 */
	public static List<String> string2List(Object o) {
		List<String> al = new ArrayList<String>();
		String[] s;
		if (o.toString().contains("[")) {
			s = o.toString().substring(1, o.toString().length() - 1).split(",");
		} else {
			s = o.toString().split(",");
		}
		for (String string : s) {
			al.add(string.trim());
		}
		return al;
	}
}
